#pragma once
#include <core/sync/lock.h>
#include <qbmessage/include/message_bond.h>
#include <qbprotocol/include/SSGMktModel.h>
#include <qbprotocol/include/SSMsgStruct.h>
#include <QString>
#include <QTime>
#include <array>

/*全球市场指数（批量）数据*/
struct GMktIndex;
class MessageReceiver;
class FIGMktIndexPriceData {
public:
    enum GMktIndexID {

        IRS_FR1Y = 0,
        IRS_FR5Y,
        IRS_SHIBOR1Y,
        IRS_SHIBOR5Y,

        SSEC,		//上证指数
        CSI300,		//沪深300
        SZI,		//深证成指
        USDX,		//美元指数
        GEM,		//创业板指
        US10YR,		//10Y美债
        WTICRUDE,	//WTI原油
        BRENTCRUDE,  //布伦特原油
        XIN9,	    //富时A50
        HSI,		//恒生指数
        VIX,		//VIX指数

        MaxCount // = 15
    };

public:
    FIGMktIndexPriceData();
    ~FIGMktIndexPriceData();
    //qb::base::Mutex& getLock() { return m_lock; };

    void reqData(MessageReceiver* msgRecv, const std::vector<int> current_indexes);
    int onReceive(int32_t funcId, const qb::SSAckMsg& msg);

    bool getData(const GMktIndexID& index_id, QString& price, QString& updownValue, QString& updownPoint, time_t& time);

private:
    void selectIndex(MessageReceiver* msgRecv, const GMktIndexID& index_id, const bool& select);

private:
    std::array<GMktIndex*, MaxCount> m_GMktIndexPriceData; // <指标代码 key, 指标数据>;

};

